<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/components/bootstrap-validator/bootstrap-validator.jsp"%>
<title>创建角色</title>
</head>
<body>

    <p class='breadcrumb'>权限管理 &raquo; 数据字典列表</p>

    <form:form id="defaultForm" modelAttribute="voModel" method="post" action="save.do" role="form" class="well form-horizontal">
        <form:hidden path="version" value="0" />

        <c:if test="${hasErrors}">
            <div class="alert alert-danger alert-dismissible" role="alert">
                <button type="button" class="close" data-dismiss="alert">
                <span aria-hidden="true">&times;</span>
                <span class="sr-only">Close</span></button>
                <form:errors path="*"/>
            </div>
        </c:if>

        <div class="form-group">
            <label class="col-sm-3 control-label" for="type">字典类型:</label>
            <div class="col-sm-9 controls">
                <form:input path="type" type="text" class="form-control" placeholder="字典类型"/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label" for="key">键:</label>
            <div class="col-sm-9 controls">
                <form:input path="key" type="text" class="form-control" placeholder="键"/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label" for="key">值:</label>
            <div class="col-sm-9 controls">
                <form:input path="value" type="text" class="form-control" placeholder="值"/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label" for="key">描述:</label>
            <div class="col-sm-9 controls">
                <form:input path="desc" type="text" class="form-control" placeholder="描述"/>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-3 col-sm-9">
                <button type="submit" id="saveBtn" name="saveBtn" class="btn btn-primary">保存</button>
                <a class="btn btn-default" href="${ctx}/system/dataDictionary/list.do">返回</a>
            </div>
        </div>

    </form:form>

<script type="text/javascript">
$(document).ready(function() {

    $('#defaultForm').formValidation({
        message: 'This value is not valid',
        icon: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            type: {
                validators: {
                    notEmpty: {
                        message: '字典类型不能为空！'
                    }
                }
            },
            key: {
                validators: {
                    notEmpty: {
                        message: '字典键不能为空！'
                    }
                }
            },
            value: {
                validators: {
                    notEmpty: {
                        message: '字典值不能为空！'
                    }
                }
            }
        }
    });
});
</script>

</body>
</html>

